package com.naiterui.ehp.bs.patient.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.naiterui.ehp.bp.domain.PatientPersonDoctor;
import com.naiterui.ehp.bp.domain.PatientPersonDoctorPK;
import com.naiterui.ehp.bs.patient.dao.IPatientPersonDoctorDao;
import com.naiterui.ehp.bs.patient.service.IDrMedicationRecomService;
import com.naiterui.ehp.bs.patient.vo.FirstIsit;

/**
 * 推荐列表
 *
 * @author wangzehao
 */
@Service
public class ApDrMedicationRecomServiceImpl implements IDrMedicationRecomService {

    @Autowired
    private IPatientPersonDoctorDao iPatientPersonDoctorDao;

    /**
     * 通过医生和患者ID获取该患者是不是初复诊
     *
     * @param patientId 患者ID
     * @param doctorId  医生ID
     *
     * @return
     */
    @Override
    public FirstIsit firstisit(Long patientId, Long doctorId) {
        PatientPersonDoctorPK patientPersonDoctorPK = new PatientPersonDoctorPK();
        patientPersonDoctorPK.setPatientId(patientId);
        patientPersonDoctorPK.setDoctorId(doctorId);
        PatientPersonDoctor patientPersonDoctor = this.iPatientPersonDoctorDao.findByPatientIdAndDoctorId(patientId, doctorId);
        return new FirstIsit(patientPersonDoctor == null ? FirstIsit.IS_FIRSTISIT : FirstIsit.NOT_FIRSTISIT);// 初诊or复诊
    }

}
